/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import 'package:flutter/cupertino.dart';

import '../../../l10n/generated/app_localizations.dart';
import 'card.dart';

class CardList extends StatefulWidget {
  final num currentWidth;
  final Function activeCallBack;
  final String activeName;

  const CardList({Key? key, required this.currentWidth,required this.activeName,  required this.activeCallBack}) : super(key: key);

  @override
  State<CardList> createState() => _CardListState();
}

class _CardListState extends State<CardList> {


  @override
  Widget build(BuildContext context) {
    AppLocalizations il8n = AppLocalizations.of(context)!;

    List cardList = [
      {
        'name': 'Tom',
        'ava': 'lib/assets/images/avatar/avatar_1.png'
      },
      {
        'name': il8n.dengshuangshuang,
        'ava': 'lib/assets/images/avatar/avatar_2.png'
      },
      {
        'name':il8n.zuqiuxiehui,
        'ava': 'lib/assets/images/avatar/avatar_3.png'
      },
      {
        'name': il8n.ziyoudetonton,
        'ava': 'lib/assets/images/avatar/avatar_4.png'
      },
      {
        'name': il8n.zhangxiaomeng,
        'ava': 'lib/assets/images/avatar/avatar_5.png'
      },
      {
        'name': 'Tom1',
        'ava': 'lib/assets/images/avatar/avatar_6.png'
      },
      {
        'name': 'Jack1',
        'ava': 'lib/assets/images/avatar/avatar_1.png'
      },
      {
        'name': 'Jack2',
        'ava': 'lib/assets/images/avatar/avatar_1.png'
      },
      {
        'name': 'Jack3',
        'ava': 'lib/assets/images/avatar/avatar_1.png'
      }
    ];

    return Column(
      children: cardList.map((item) {
        return CardItem(
            currentWidth: widget.currentWidth + 0,
            name:item['name'] ,
            message: il8n.youPulledBackAMessage,
            ava:item['ava'],
            messageNum:'22',
            activeCallBack:widget.activeCallBack,
            activeName:widget.activeName
        );
      }).toList()
    );
  }
}
